package site.icesky.springboot.rocketmq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import site.icesky.springboot.rocketmq.service.MqProducerService;

/**
 * @ClassName: RocketMqController <br>
 * @Description: 测试类 <br>
 * @Package: site.icesky.springboot.rocketmq.controller <br>
 * @author: suitianmou <br>
 * @Date: 2020/5/24-11:17 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */
@Controller
public class RocketMqController {

    private static final String RESPONSESUCCESS="SUCCESS";
    private static final String RESPONSEFAILURE="FAILURE";

    @Autowired
    MqProducerService mqProducerService;

    // 我们
    @RequestMapping(path="/mqsend/{message}")
    @ResponseBody
    public String mqSend(@PathVariable String message ){

        boolean result = mqProducerService.sendMessage(message);
        if( result ){
            return RESPONSESUCCESS;
        }else{
            return RESPONSEFAILURE;
        }
    }
}
